﻿using System;

namespace ValidationHelper.Validators
{
    public class StringMinimumLengthValidator : StringValidator
    {
        #region Propriedades
        public int MinimumLength { get; set; }
        #endregion

        #region Construtores
        public StringMinimumLengthValidator(string message, Type exceptionType, string stringToValidate, int minimumLength)
            : base(message, exceptionType, stringToValidate)
        {
            MinimumLength = minimumLength;
        }
        #endregion

        #region Métodos
        protected override bool IsNotValid()
        {
            return (string.IsNullOrEmpty(StringToValidate) && MinimumLength > 0) || (!string.IsNullOrEmpty(StringToValidate) && StringToValidate.Length < MinimumLength);
        }
        #endregion
    }
}